//
//  SWSquareLayout.swift
//  新浪微博
//
//  Created by Mac on 17/1/3.
//  Copyright © 2017年 itcast. All rights reserved.
//

import UIKit

class SWSquareLayout: UICollectionViewFlowLayout {

    override func prepare() {
        super.prepare()
        
        // 计算单元格尺寸
        let width = ((collectionView?.bounds.width)! - 10) / 3
        let height = width + 20
        
        itemSize = CGSize(width: width, height: height)
        scrollDirection = UICollectionViewScrollDirection.vertical
        minimumLineSpacing = 0
        minimumInteritemSpacing = 0
    }
}
